<style type="text/css">
    .modal-body{height:479px;overflow-y: scroll;}
</style>
<section class="content">
    <!-- Small boxes (Stat box) -->
    <div class="row">
    	<div class="col-md-12">
            <div class="dataTables_filter">
            	<span style="margin-right:300px;font-size:15px;font-weight:bold;color:#3c8dbc">共：{{$number}}条</span><span style="font-size:15px;font-weight:bold;color:#3c8dbc">总金额：￥{{$total}}</span>
            </div>
          	<ul class="timeline">
	            <!-- /.timeline-label -->
          		@foreach($logs as $log)
		            <!-- timeline item -->
		            <li>
		              <i class="fa fa-fw fa-money bg-blue"></i>

		              <div class="timeline-item">
		                <span class="time"><i class="fa fa-clock-o"></i> {{$log->created_at}}</span>

		                <h3 class="timeline-header"><a href="javascript:void(0)">@if($log->type == 1 || $log->type==2) 银票返利 @elseif($log->type == 3) 亲友圈返利 @endif</a></h3>

		                <div class="timeline-body">
		                	返利金额：{{$log->fee}}
		                </div>
		                <div class="timeline-footer">

		                </div>
		              </div>
		            </li>
	            @endforeach
	            <!-- end -->
	            <li class="li-end">
	              <i class="fa fa-clock-o bg-gray"></i>
	            </li>
        	</ul>
    	</div>
    	<div align="center">
    		<a class="refresh" href="javascript:void(0)"><i class="fa fa-fw fa-refresh"></i>加载更多</a>
		</div>
    </div>
</section>

<script type="text/javascript">
	var page = 2;//初始页码
    $(".refresh").click(function(){
        $.ajax({
          type: "get",
          dataType: "json",
          url: '/admin/withdraw/load_source/{{$withdraw->id}}',
          data: {
            page: page,
            pagesize: 3
          },
          success: function (data) {
            if (data.flag) {
            	if (data.data.length > 0) {
            		$('.li-end').remove();
	            	page += 1;
	                var html = '';
	                for (var i=0;i<data.data.length;i++) {
		            	html += '<li><i class="fa fa-fw fa-money bg-blue"></i><div class="timeline-item"><span class="time"><i class="fa fa-clock-o"></i>'+data.data[i].created_at+'</span><h3 class="timeline-header"><a href="javascript:void(0)">';
						if(data.data[i].type == 1 || data.data[i].type == 2) { html += '银票返利';} else if (data.data[i].type == 3) { html += '亲友圈返利';}
					    html += '</a></h3><div class="timeline-body">返利金额：'+data.data[i].fee+'</div><div class="timeline-footer"></div></div></li>';    	
	                }
	                html += '<li class="li-end"><i class="fa fa-clock-o bg-gray"></i></li>';
	                $(".timeline").append(html);
            	} else {
            		$(".refresh").html('暂无更多');	
            	}
            } else {
                $(".refresh").html('暂无更多');
            }
          }
        });
    });      
</script>